package com.lntu.meeting.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class Config extends WebMvcConfigurerAdapter {
    //跨域处理
    @Override
    public void addCorsMappings(CorsRegistry registry) {

        registry.addMapping("/**")//允许访问全部资源

                .allowedOrigins("http://localhost:8080","null")//请求来源

                .allowedMethods("GET","POST","PUT","OPTIONS","DELETE")//请求方式

                .allowCredentials(true)//允许携带

                .maxAge(3600);//响应时间
    }
}
